<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>自定义指令directive</title>
    <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
    <h2>元素、属性、方法</h2>
    <div ng-app="app01" ng-controller="ctrl01">
        <hello title="这是属性title的值"></hello>
    </div>
    <script>
        var app01 = angular.module('app01', []);
        app01.directive("hello",function(){
            return{
                restrict:'EAC',
                template: function(tElement,tAttrs){
                    var _html = '';
                    _html += '<div>' +'hello '+tAttrs.title+'</div>';
                    return _html;
                }
            };
        });
    </script>
    <h2>templateUrl</h2>
    <div ng-app="app02" ng-controller="ctrl02" id="app02">
        <hello-word></hello-word>
    </div>
    <script>
        var app02=angular.module("app02",[]);
        app02.directive('helloWord', function() {
            return {
                restrict: 'E',
                templateUrl: 'demo.html',
                replace: true
            };
        });
        angular.bootstrap(document.getElementById("app02"),["app02"]);
    </script>
    <script type='text/ng-template' id='index.html'>
        <div><h1>Hi 我是林炳文~~~</h1></div>
    </script>
</body>
</html>